import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "root",
      redirect: "/register",
    },
    {
      path: "/discover",
      name: "discover",
      redirect: "/discover/songs", // 修改这里
      component: () => import("../views/discover/DiscoverView.vue"),
      children: [
        {
          path: "playlist",
          name: "playlist",

          component: () =>
            import("../views/discover/childrenViews/PlaylistView.vue"),
        },
        {
          path: "songs",
          name: "songs",
          component: () =>
            import("../views/discover/childrenViews/SongsView.vue"),
        },
        {
          path: "artists",
          name: "artists",
          component: () =>
            import("../views/discover/childrenViews/ArtistsView.vue"),
        },
      ],
    },
    {
      path: "/recent-plays",
      name: "recent-plays",
      component: () => import("../views/recentPlays/RecentPlaysView.vue"),
    },
    {
      path: "/artist/:id",
      name: "artist-profile",
      component: () => import("../views/artistProfile/ArtistProfileView.vue"),
    },
    {
      path: "/song/:id",
      name: "song-detail",
      component: () => import("../views/songDetail/SongDetailView.vue"),
    },
    {
      path: "/playlist/:id",
      name: "playlist-detail",
      component: () => import("../views/playlistDetail/PlaylistDetailView.vue"),
    },
    {
      path: "/register",
      name: "register",
      component: () => import("../views/register/RegisterView.vue"),
    },
    {
      path: "/my-favorites",
      name: "my-favorites",
      component: () => import("../views/myFavorites/MyFavoritesView.vue"),
    },
    {
      path: "/user/:id",
      name: "user-profile",
      component: () => import("../views/userProfile/UserProfileView.vue"),
    },
    {
      path: "/search",
      name: "search",
      component: () => import("../views/search/SearchView.vue"),
    },
    {
      path: "/settings/profile",
      name: "profile-settings",
      component: () => import("../views/settings/ProfileSettingsView.vue"),
    },
    {
      path: "/notifications",
      name: "notifications",
      component: () => import("../views/notifications/NotificationsView.vue"),
    },
    {
      path: "/creator-center",
      name: "creator-center",
      component: () => import("../views/creatorCenter/CreatorCenterView.vue"),
      meta: { requiresSinger: true },
    },
    {
      path: "/terms",
      name: "terms",
      component: () => import("../views/legal/TermsView.vue"),
    },
    {
      path: "/privacy",
      name: "privacy",
      component: () => import("../views/legal/PrivacyView.vue"),
    },
  ],
});

export default router;
